<template>
  <div class="cms-scroll" :class="`style_${type}`">
    <div class="type-four">
      <div class="hit">
        <span class="hot-play">{{ title ? title : '重磅热播' }}</span>
        <div class="more">
          <span>更多</span>
          <right-outlined class="ml-[6px]" />
        </div>
      </div>
      <div class="video-grid">
        <div class="video" v-for="(item, index) in 3" :key="index">
          <div class="video_shadow">
            <img :src="homeIcons.film" alt="" class="img-show" />
            <p class="episodes tur dome-text">集数</p>
          </div>
          <p class="title">影片名称</p>
          <p v-if="type !== 2 && !title" class="des">影片大概简介</p>
          <div v-if="type === 2" class="watch">观看</div>
          <div v-if="index % 2 === 0" class="free">免费</div>
          <div v-else class="gold">
            <dollar-outlined class="gold-icon" />
            <span>100</span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script lang="ts">
import { defineComponent } from 'vue'
import cmsScrollGridProps from './props'
import { RightOutlined, DollarOutlined } from '@ant-design/icons-vue'
import homeIcons from '../../assets'

export default defineComponent({
  props: cmsScrollGridProps,
  setup() {
    return {
      homeIcons
    }
  },
  components: {
    RightOutlined,
    DollarOutlined
  }
})
</script>

<style scoped lang="less">
.cms-scroll {
  width: 375px;
  padding: 8px 0 8px 16px;
  background-color: #fff;
  .hit {
    @apply flex justify-between;
  }
  .more {
    font-size: 12px;
    color: #848494;
    text-align: center;
    align-self: center;
    font-weight: 400;
    margin-right: 20px;
  }
  .video-grid {
    overflow: hidden;
    @apply flex gap-x-2 mt-4;
    .video {
      position: relative;
    }
  }
  .hot-play {
    font-size: 16px;
    color: #000;
  }
  .episodes {
    font-size: 12px;
    color: #fff;
    text-align: right;
    position: absolute;
    top: 161px;
    right: 12px;
  }
  .title {
    font-size: 14px;
    color: #000000;
    letter-spacing: 0;
    text-align: left;
    font-weight: 500;
    margin-top: 8px !important;
  }
  .des {
    font-size: 12px;
    text-align: left;
    margin-top: 4px !important;
    color: #848494;
    font-weight: 400;
  }
  .free {
    width: 36px;
    height: 20px;
    background-image: linear-gradient(135deg, #ffa45d 0%, #ff613f 100%);
    border-radius: 0 8px 0 8px;
    font-size: 12px;
    color: #ffffff;
    padding: 2px 6px;
    position: absolute;
    right: 0;
    top: 0;
  }
  .gold {
    // width: 48px;
    height: 20px;
    background-image: linear-gradient(135deg, #eed78e 0%, #cbae6c 100%);
    border-radius: 0 8px 0 8px;
    font-size: 12px;
    color: #ffffff;
    padding: 2px 6px;
    position: absolute;
    right: 0;
    top: 0;
  }
  .gold-icon {
    margin-right: 2px;
    font-size: 14px;
  }
  &.style_1 {
    .video_shadow {
      width: 136px;
      height: 181px;
      border-radius: 8px;
      .img-show {
        width: 70px;
        object-fit: cover;
      }
    }
  }
  &.style_2 {
    .video_shadow {
      width: 109px;
      height: 145px;
      border-radius: 8px;
      .img-show {
        width: 51px;
        object-fit: cover;
      }
    }
    .episodes {
      font-size: 12px;
      color: #fff;
      text-align: right;
      position: absolute;
      top: 125px;
      right: 4px;
    }
    .watch {
      width: 58px;
      height: 27px;
      text-align: center;
      background: #ff613f;
      border-radius: 27px;
      line-height: 27px;
      color: #fff;
      font-size: 14px;
      margin-top: 14px;
    }
  }
  &.style_3 {
    .video_shadow {
      width: 136px;
      height: 77px;
      .img-show {
        width: 51px;
        border-radius: 8px;
      }
    }
    .episodes {
      font-size: 12px;
      color: #fff;
      text-align: right;
      position: absolute;
      top: 57px;
      right: 8px;
    }
  }
  &.style_4 {
    padding: 8px 16px;
    .type-four {
      padding: 16px 0 12px 12px;
      background: #4f3f3a;
      border-radius: 16px;
    }
    .more {
      margin-right: 17px;
    }
    .hot-play {
      font-size: 16px;
      color: #fff;
    }
    .video_shadow {
      width: 100px;
      height: 133px;
      border-radius: 8px;
      .img-show {
        width: 51px;
        object-fit: cover;
      }
    }
    .title,
    .des {
      color: #fff;
    }
    .des {
      width: 100px;
      opacity: 0.6;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .episodes {
      font-size: 12px;
      color: #fff;
      text-align: right;
      position: absolute;
      top: 113px;
      right: 8px;
    }
  }
}
</style>
